package dt.day03.demo;

import java.util.Comparator;

/**
 * Person 根据金额进行排序
 * 实现 Comparator 接口
 */
public class PersonComparator implements Comparator<Person> {
    @Override
    public int compare(Person o1, Person o2) {
        //从小到大
        //return o1.getAmount().compareTo(o2.getAmount());
        //从大到小
        return o2.getAmount().compareTo(o1.getAmount());
    }
}
